package com.pine.dcts.utils;

import com.pine.dcts.common.DctsException;
import org.springframework.util.ResourceUtils;

import java.io.FileNotFoundException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;

public class FileUtils {

    public   static  String getAbsPath(String initPath){
        String path;
        try {
            path = ResourceUtils.getURL("classpath:").getPath();
            path = URLDecoder.decode(path, "UTF-8");
            path+=initPath;
        } catch (UnsupportedEncodingException | FileNotFoundException e) {
            throw new DctsException("文件路径解析错误");
        }
        return path;
    }

}
